<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .menu{
            width: 100px;
            height: 200px;
            background-color: red;
            position: absolute;
            left: 0px;
            top: 0px;
            display: none;
        }
    </style>
</head>
<body>
    <div class="menu"></div>

    <script>
        var menuELe = document.querySelector(".menu");
        document.oncontextmenu = function(e){
            menuELe.style.display = "block";
            // 把div的位置移动到鼠标右键的位置；
            var x = e.clientX;
            var y = e.clientY;
            menuELe.style.left = x + "px";
            menuELe.style.top = y + "px";
            e.preventDefault();
        }

    </script>
</body>
</html>